import type { NextApiResponse } from 'next';
import * as newsService from '@/common/service/g_news';
import { withAuth, AuthenticatedRequest } from '@/common/middleware/auth';

async function handler(req: AuthenticatedRequest, res: NextApiResponse) {
  const { _start = 0, _end = 10 } = req.query;
  const data = await newsService.getNewsList({}, Number(_start), Number(_end));
  res.status(200).json({ success: true, data });
}

export default withAuth(handler, { GET:'project:news:list'});